<!--该画面是：报价单维护画面 -->
<template>
  <div>
    <el-table ref="table1" v-loading="loading" :data="quoteList" border :default-sort="{ prop: 'quote_date', order: 'ascending' }">
      <el-table-column :label="$t('quoteNo')" prop="quote_no" width="100" />
      <el-table-column :label="$t('quoteType')" prop="quote_type_desc" width="90" />
      <el-table-column :label="$t('quoteContent')" prop="quote_content" width="320" show-tooltip-when-overflow />
      <el-table-column :label="$t('quoteDate')" prop="quote_date" sortable align="center" width="110" />
      <el-table-column :label="$t('quoteAmount')" prop="quote_amount" align="right" width="120" />
      <el-table-column :label="$t('quoteCurrency')" prop="quote_curr" align="right" width="120" />
      <el-table-column :label="$t('standardCurrency')" prop="standard_curr" align="right" width="120" />
      <el-table-column :label="$t('rate')" prop="exchange_rate" align="right" width="120" />
      <el-table-column :label="$t('standardAmount')" prop="rate_amount" align="right" width="120" />
      <el-table-column :label="$t('quoteDays')" prop="quote_days" align="right" width="120" />
      <el-table-column :label="$t('receiveDate')" prop="receive_date" align="center" width="110" />
      <el-table-column :label="$t('quoteNote')" prop="note" min-width="220" show-tooltip-when-overflow />
      <el-table-column :label="$t('createdUser')" prop="created" width="100" />
      <el-table-column :label="$t('createdDate')" prop="created_date" width="160" />
      <el-table-column :label="$t('createdProgram')" prop="created_program" width="200" show-overflow-tooltip />
      <el-table-column :label="$t('updatedUser')" prop="updated" width="100" />
      <el-table-column :label="$t('updatedDate')" prop="updated_date" width="160" />
      <el-table-column :label="$t('updatedProgram')" prop="updated_program" width="200" show-overflow-tooltip />
    </el-table>
  </div>
</template>

<script>
import { getProjectQutaListApi } from '@/views/project/projectquota/api/projectquota.api';

export default {
  name: 'ProjectQuotaInfo',
  props: {
    title: {
      type: String,
      default: ''
    },
    projectPlanId: {
      required: true,
      type: Number
    }
  },
  data() {
    return {
      loading: false,
      quoteList: [],
      detailParams: {
        projectPlanFK: undefined,
        page: 1,
        page_size: 10
      }
    }
  },
  mounted() {
    this.$watch(() => {
      return this.projectPlanId;
    }, async(newValue) => {
      this.detailParams.projectPlanFK = newValue;
      await this.getQuoteList();
    }, { immediate: true })
  },
  methods: {
    // 获取报价单数据
    async getQuoteList() {
      this.detailParams.projectPlanFK = this.projectPlanId
      this.loading = true
      var resp = await getProjectQutaListApi({ ...this.detailParams })
      if (resp.success) {
        this.quoteList = resp.data.results
      } else {
        this.quoteList = []
      }
      this.loading = false
    }
  }
};
</script>

  <style scoped>
  @import "~@/views/projectbase/projectcss/project.css";
  </style>
